package jdk8;

public class LamdaTest1 {
    int field = 1;
    public static void main(String[] args) {
        LamdaTest1 lamdaTest1 = new LamdaTest1();
        LamdaTest1_I i1 = (a, b) -> {
            System.out.println(a + b); //3
        };

        int param = 99;
        String s = "123";


        LamdaTest1_I i2 = new LamdaTest1_I() {
            @Override
            public void fun1(int a, int b) {
                System.out.println(param); // 99
            }
        };

        LamdaTest1_I2 i3 = a -> a * 2;

        LamdaTest1_I i4 = (a, b) -> System.out.println();

        LamdaTest1_I i5 = (a, b) -> System.out.println();

//        LamdaTest1_I i6 = (a, b) -> {
//            param ++;
//        };
        LamdaTest1_I i7 = new LamdaTest1_I() {
            @Override
            public void fun1(int a, int b) {
                lamdaTest1.field = 2;
            }
        };

        i1.fun1(1, 2); //3
        i2.fun1(1, 2); // 99
    }
}


interface LamdaTest1_I {
    void fun1(int a, int b);

}

interface LamdaTest1_I2 {
    int fun1(int a);

}

interface LamdaTest1_I3 {
    String fun1(String s);

}

abstract class LamdaTest1_C1 {

    abstract String fun1(String s);
}